Skip to content

fix(model_loader): drop deprecated resume_download kwarg#2053

Open
romanbsd wants to merge 2 commits into
unclecode:developfrom
romanbsd:fix/model-loader-resume-download
Open

fix(model_loader): drop deprecated resume_download kwarg#2053
romanbsd wants to merge 2 commits into
unclecode:developfrom
romanbsd:fix/model-loader-resume-download

Conversation

@romanbsd

@romanbsd romanbsd commented Jul 4, 2026

Copy link
Copy Markdown

Summary

Split out of #2046 as the first of three focused PRs, per @ntohidi's review request.

Recent transformers releases removed the resume_download argument from from_pretrained, so passing resume_download=None raises a TypeError. This drops the deprecated kwarg from the three model loaders and adds unit tests that assert the loaders call from_pretrained with the current API (no resume_download).

Changes

  • crawl4ai/model_loader.py — remove resume_download=None from load_bert_base_uncased, load_HF_embedding_model, load_text_multilabel_classifier
  • tests/unit/test_model_loader_transformers.py — new tests (mock transformers, no network/model download)

Testing

pytest tests/unit/test_model_loader_transformers.py — 3 passed.

Follow-ups from the same review: dependency bumps are in two separate PRs (minor/patch, and major).

🤖 Generated with Claude Code

@romanbsd romanbsd mentioned this pull request Jul 4, 2026
6 tasks
@ntohidi

ntohidi commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

@romanbsd Thanks for your contribution :)

@ntohidi

ntohidi commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the clean split, @romanbsd. The model_loader.py fix and tests look good.

One issue: test_multilabel_loader_uses_current_from_pretrained_api doesn't mock scipy. Since load_text_multilabel_classifier() imports from scipy.special import expit, the test will fail in environments without scipy installed (it's not a core dependency). Could you add mocks for it alongside the existing transformers and torch ones?

monkeypatch.setitem(sys.modules, "scipy", SimpleNamespace())
monkeypatch.setitem(sys.modules, "scipy.special", SimpleNamespace(expit=lambda x: x))

romanbsd and others added 2 commits July 14, 2026 11:51
…etrained

Recent transformers releases removed the `resume_download` argument from
`from_pretrained`, so passing `resume_download=None` raises a TypeError.
Use the default API and add unit tests covering the three loaders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
load_text_multilabel_classifier imports scipy.special.expit at call
time; mock it alongside the existing transformers/torch mocks so the
test doesn't require scipy installed.
@romanbsd romanbsd force-pushed the fix/model-loader-resume-download branch from 0eee2d2 to a827019 Compare July 14, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants